package cn.zzmx.service;


import cn.zzmx.entity.User;
import cn.zzmx.mapper.IUserMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.REPEATABLE_READ,readOnly = false)
public class IUserServiceImpl implements IUserService{


    @Autowired
    private IUserMapper iUserMapper;

    @Override
    @Transactional(readOnly = true)
    public PageInfo<User> queryUserAll(Integer page, Integer limit) {
        PageHelper.startPage(page,limit);
        PageInfo<User> pageInfo = new PageInfo<User>(iUserMapper.queryUserAll());
        return pageInfo;
    }

    @Override
    @Transactional(readOnly = true)
    public User queryUserDetails(String userId) {
        return iUserMapper.queryUserDetails(userId);
    }
}
